<!--
  移动签批->移动签批
-->
<template>
  <view>
    <van-collapse v-model="topShow" accordion>
      <!--   待办文件：dbwj，待阅文件：dywj-->
      <van-collapse-item style="background-color:#0000FE" name="dbwj">
        <template #title>
          <view :class="topShow == 'dbwj'?'content':''">
            <span><i class="iconfont icon-jieshou1 content-icon"></i>待办文件</span>
            <van-badge v-if="total0 > 0" :content="total0 || 0" max="99" class="content-badge"></van-badge>
          </view>
        </template>
        <signList01 :todoTab="todoTab3" :url="dbwjUrl"/>
      </van-collapse-item>

      <van-collapse-item name="dywj">
        <template #title>
          <view :class="topShow == 'dywj'?'content':''">
            <span><i class="iconfont icon-banlizhongxin content-icon"></i>待阅文件</span>
            <van-badge v-if="total1 > 0" :content="total1 || 0" max="99" class="content-badge"></van-badge>
          </view>
        </template>
        <signList02 :todoTab="todoTab3" :url="dywjUrl" from="dywj"/>
      </van-collapse-item>

    </van-collapse>
  </view>
</template>

<script>
import signList01 from 'pages/caac/components/sendDoc/compo-signList.vue'
import signList02 from 'pages/caac/components/sendDoc/compo-signList.vue'

export default {
  components: {
    signList01,
    signList02,
  },
  onLoad: async function (option) {
    await this.$onLaunched //解決bug：执行完onLaunch后再执行页面onLoad
    this.userInfo = this.cache.get('userInfo')//从缓存获取用户信息
    //从地址栏获取proInstId
    if (option.topShow != undefined && option.topShow != '') {
      this.topShow = option.topShow
    }
    this.daibanWorks()//待办文件
    this.dyworks()//待阅文件
  },
  data() {
    return {
      userInfo: {},//当前登录用户信息，目前先从缓存中获取
      todoTab0: '0',//紧急重要
      todoTab1: '1',//限时办文
      todoTab2: '2',//待审签
      todoTab3: '3',//待阅办
      dbwjUrl: 'todowork/daibanWorks',
      dywjUrl: 'todowork/dyworks',
      total0: 0,
      total1: 0,
      topShow: 'dbwj',//默认展开哪个
      page: 1,
      rows: 10,

    };
  },
  mounted() {
  },
  methods: {
    //待办文件
    daibanWorks() {
      this.$http({
        url: this.$http.adornUrl(`/caac/oa/todowork/daibanWorks`),
        method: 'get',
        params: this.$http.adornParams({
          'title': '',//查询传
          'bizTypeCode': '',//查询传
          'todoTab': 0,//固定值
          'page': this.page,
          'rows': this.rows,
          'systemKey': this.userInfo.systemKey, //固定值
          'systemFlag': this.userInfo.systemFlag, //固定值
        })
      }).then(({data}) => {
        if (data.code == 200) {
          this.total0 = data.data.total
        } else {
          this.$toast(data.message)
        }
      })
    },
    //待阅文件
    dyworks() {
      this.$http({
        url: this.$http.adornUrl(`/caac/oa/todowork/dyworks`),
        method: 'get',
        params: this.$http.adornParams({
          'title': '',//查询传
          'bizTypeCode': '',//查询传
          'todoTab': 3,//固定值
          'page': this.page,
          'rows': this.rows,
          'systemKey': this.userInfo.systemKey, //固定值
          'systemFlag': this.userInfo.systemFlag, //固定值
        })
      }).then(({data}) => {
        if (data.code == 200) {
          this.total1 = data.data.total
        } else {
          this.$toast(data.message)
        }
      })
    },
  },
};
</script>

<style>
	/deep/ .van-collapse-item__content {
		padding: 0px;
		color: #969799;
		font-size: 14px;
		line-height: 1.5;
		background-color: #fff
	}
  .content {
    font-weight: 600;
    color: #007aff;
  }
  .content-icon {
    margin-right: 10rpx;
  }
  .content-badge {
    margin-left: 10rpx;
  }
</style>
